<div class="wrap-color-lightgray">
    <div class="container theme-showcase" role="main">
        <div class="row">
            <div class="col-md-8">
                <ol class="breadcrumb media-nav">
                    <li><a href="{:url('/index/index')}">首页</a></li>
                    <li>会员动态</li>
                </ol>
                <!--动态列表-->
                <div class="bs-example" style="background:#fff;padding:15px 15px 0px 15px">
                    <?php foreach($dynamic as $item){?>
                    <div class="media">
                        <div class="media-left">
                            <a href="#">
                                <img class="media-object" alt="64x64" src="<?php echo config('upload.imgurl').$item['face']; ?>" style="width: 64px; height: 64px;">
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading"><?php echo $item['username']; ?><span class="media-pubtime"><?php echo date('Y-m-d H:i',$item['pubtime']); ?></span></h4>
                            <?php echo $item['content']; ?>
                            <?php if(!empty($item['media'])){ ?>
                            <div>
                                <img class="thumbnail" src="<?php echo config('upload.imgurl').$item['media']; ?>" style="height: 100%; width: 180px; alt="">
                            </div>
                            <?php } ?>
                            <p class="pull-right">
                                <button type="button" onclick="praise(this,<?php echo $item['dy_id']; ?>)" class="btn btn-default btn-xs">
                                    <span class="glyphicon glyphicon-heart-empty"></span> I like
                                </button>
                                <button type="button" class="btn btn-default btn-xs">
                                    <span class="glyphicon glyphicon-edit"></span> say something
                                </button>
                            </p>
                        </div>
                    </div>
                    <hr class="featurette-divider">
                    <?php } ?>
                    <!--pagination start-->
                    <div class="pull-right media-page">
                        {$dynamic|raw}
                    </div>
                    <!--pagination end-->
                    <div style="clear: both"></div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="special">
                    <h4>推荐</h4>
                    <span class="redborder"></span>
                    <a href="#" class="thumbnail">
                        <img src="__INDEX__/images/new_lists02.jpg" alt="图片">
                    </a>
                    <div class="list-group special-list">
                        <?php foreach($recommend as $item){?>
                        <a href="{:url('/index/article/detail/iid/'.$item['info_id'])}" class="list-group-item" title="<?php echo $item['title']; ?>"><?php echo mb_substr($item['title'],0,12,'UTF-8').'...';?><span class="pull-right" style="font-size: 14px;"><?php echo date('Y-m-d',$item['pubtime']); ?></span></a>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    //点赞触发该函数
    function praise(obj,id){
        $.ajax({
            type:"GET",
            data:{'id':id},
            url:"{:url('/index/dynamic/praise')}",
            dataType:"json"
        }).done(function(result){
            if (parseInt(result)==1){
                $(obj).css('color','red');
            } else{
                alert("网络出错！");
            }
        });
    }
</script>